package com.lagou.demo.controller;

import com.lagou.edu.mvcframework.annotations.LagouController;
import com.lagou.edu.mvcframework.annotations.LagouRequestMapping;
import com.lagou.edu.mvcframework.annotations.LagouSecurity;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@LagouController
@LagouRequestMapping("/mixed")
public class MixedController {
    @LagouRequestMapping("/admin.do")
    @LagouSecurity("admin")
    public void admin(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        go(request,response);
    }

    @LagouRequestMapping("/public.do")
    public void anyInner(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        go(request,response);
    }

    private void go(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.getRequestDispatcher("/WEB-INF/views/success.jsp").forward(request, response);
    }
}
